<?php
/**
 * Author: Administrator
 * Date: 2022/7/15 2:44
 */

namespace DesignPatterns\Creation\FactoryMethod;


class ItalianFactory extends FactoryMethod
{

    protected function createVehicle($type)
    {
        switch ($type) {
            case parent::SLOW:
                return new Bicycle();
                break;
            case self::FAST:
                return new Ferrari();
                break;
            default:
                throw new \InvalidArgumentException("$type is not a valid vehicle");
        }
    }
}